<?php

namespace Rjyst\RjVirtual;

use Illuminate\Support\ServiceProvider;

class RjVirtualServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap services.
     */
    public function boot(): void
    {
        // 发布迁移文件
        $this->publishes([
            __DIR__.'/../database/migrations/' => database_path('migrations')
        ], 'rj-virtual-migrations');

        // 发布 Seeder 文件
        $this->publishes([
            __DIR__.'/../database/seeders/' => database_path('seeders')
        ], 'rj-virtual-seeders');

        // 发布模型文件
        $this->publishes([
            __DIR__.'/../stubs/Models/' => app_path('Models')
        ], 'rj-virtual-models');

        // 发布管理后台控制器
        $this->publishes([
            __DIR__.'/../stubs/Admin/Controllers/' => app_path('Admin/Controllers')
        ], 'rj-virtual-controllers');

        // 发布管理后台仓库
        $this->publishes([
            __DIR__.'/../stubs/Admin/Repositories/' => app_path('Admin/Repositories')
        ], 'rj-virtual-repositories');

        // 注册 Artisan 命令
        if ($this->app->runningInConsole()) {
            $this->commands([
                Console\Commands\InstallCommand::class,
                Console\Commands\UninstallCommand::class,
            ]);
        }
    }
}
